package com.zswl.decorate.widget;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.support.annotation.NonNull;
import android.view.View;

import com.zswl.decorate.R;

import butterknife.ButterKnife;
import butterknife.OnClick;

/**
 * Created by Administrator on 2018/6/23 0023.
 */

public class DeleteDialog extends Dialog {
    private Context context;
    private ConfirmListener listener;

    public DeleteDialog(@NonNull Context context) {
        super(context, R.style.ActionSheetDialogStyle);
        this.context = context;
        init();
    }

    public void setListener(ConfirmListener listener) {
        this.listener = listener;
    }

    private void init() {
        setContentView(R.layout.dialog_delete_layout);
        ButterKnife.bind(this);

    }

    @SuppressLint("MissingPermission")
    @OnClick({R.id.tv_confirm, R.id.tv_cancle})
    public void onClick(View view) {
        switch (view.getId()) {
            case R.id.tv_confirm:
                if (listener != null)
                    listener.onConfirm();
                break;
        }
        dismiss();
    }

    public interface ConfirmListener {
        void onConfirm();
    }
}
